/*
 *  Copyright (c) 2022 ZhuHai Jieli Technology Co.,Ltd.
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

#ifndef TWS_EVENT_H
#define TWS_EVENT_H

#define KEY_EVENT_FROM_TWS          (('T' << 24) | ('W' << 16) | ('S' << 8) | '\0')
#define SYS_BT_EVENT_FROM_TWS       (('T' << 24) | ('W' << 16) | ('S' << 8) | '\0')

enum {
    TWS_STA_WAIT_SIBLING_PAIR = 1,
    TWS_STA_SEARCH_SIBLING,
    TWS_STA_CREATE_CONNECTION_BREDR,
    TWS_STA_CREATE_CONNECTION_BLE,
    TWS_STA_WAIT_CONNECTION_BREDR,
    TWS_STA_WAIT_CONNECTION_BLE,
    TWS_STA_DISCONNECTION,
    TWS_STA_CONNECTION,
    TWS_STA_START_MONITOR,
    TWS_STA_MONITOR,
    TWS_STA_WAIT_PHONE_PAIR,
    TWS_STA_WAIT_PAIR,
};

enum {
    LOCAL_REMOTE_ADDR = 0,
    TWS_PAIR_REMOTE_ADDR_STATE_OK,
    TWS_PAIR_REMOTE_ADDR_STATE_NOT,
};

enum tws_detach_reason {
    TWS_DETACH_BY_SUPER_TIMEOUT = 8,
    TWS_DETACH_BY_LOCAL,
    TWS_DETACH_BY_REMOTE,
    TWS_DETACH_BY_POWEROFF,
    TWS_DETACH_BY_REMOVE_PAIRS,
    TWS_DETACH_BY_TESTBOX_CON,
    TWS_DETACH_BY_REMOVE_NO_RECONN,
};


#define TWS_CONN_CHANNEL                     0
#define TWS_LINK_SYNC_CHANNEL                1
#define TWS_LMP_SYNC_CHANNEL                 2
#define TWS_AFH_SYNC_CHANNEL                 3
#define TWS_TX_SYNC_CHANNEL                  4
#define TWS_LOW_LATENCY_CHANNEL              5
#define TWS_DATA_SYNC_CHANNEL                6
#define TWS_SBC_SYNC_CHANNEL                 7
#define TWS_EVENT_SYNC_CHANNEL               8
#define TWS_SYNC_CALL_CHANNEL                9
#define TWS_POWER_BALANCE_CHANNEL            10
#define TWS_CI_DATA_SYNC_CHANNEL             11
#define TWS_LOCAL_MEIDA_SYNC_CHANNEL         12
#define TWS_LMP_SLOT_CHANNEL                 13
#define TWS_DATA_TRANS_CHANNEL               14

enum {
    TWS_EVENT_SEARCH_TIMEOUT = 1,
    TWS_EVENT_CONNECTED,
    TWS_EVENT_CONNECTION_TIMEOUT,
    TWS_EVENT_CONNECTION_DETACH,
    TWS_EVENT_REMOVE_PAIRS,
    TWS_EVENT_PHONE_LINK_DETACH,
    TWS_EVENT_SYNC_FUN_CMD,
    TWS_EVENT_SYNC_FUN_TRANID,
    TWS_EVENT_CONNECT_TEST,
    TWS_EVENT_ROLE_SWITCH,
    TWS_EVENT_LOCAL_MEDIA_START,
    TWS_EVENT_LOCAL_MEDIA_STOP,
    TWS_EVENT_ESCO_ADD_CONNECT,
    TWS_EVENT_SETUP_MONITOR_LINK,
    TWS_EVENT_MONITOR_START,
    TWS_EVENT_DATA_TRANS_OPEN,
    TWS_EVENT_DATA_TRANS_START,
    TWS_EVENT_DATA_TRANS_STOP,
    TWS_EVENT_DATA_TRANS_CLOSE,

    TWS_EVENT_MODE_CHANGE,      // sniff without phone

    TWS_EVENT_TONE_TEST = 0xff,
};

#endif

